<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app{
            width: 400px;
            height: 600px;
            margin: 200px;
            /* background-color: aqua; */
            border: 1px solid #888;
        }
        .title input{
            border-radius: 10px;
            margin: 20px;
            width: 280px;
            height: 20px;
        }
        .title button{
            border: none;
            color: blue;
            font-size: 18px;
            margin-top: 20px;
        }
        .history{
            display: flex;
            justify-content: space-between;
            margin: 0 20px;
        }
        .history button{
            height: 30px;
            margin-top: 20px;
        }
        .list .list1{
            width: 300px;
            height: 30px;
            background-color: rgb(240, 240, 237);
            margin: 0 20px;
            text-align: center;
            line-height: 30px;
            margin: 10px;
        }
        h2{
            margin: 20px;
        }
        .bottom button{
            font-size: 16px;
            margin: 5px;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="title">
            <input type="text" placeholder="搜索商家、商品名称"v-model="inputText">
            <button @click="add">搜索</button>
        </div>
        <div class="history">
            <h2>历史搜索</h2>
            <button @click="del">删除</button>
        </div>
        <div class="list">
            <div class="list1"v-for="(item,index) in tasklist":key="index">{{item.name}}</div>
        </div>
        <div class="bottom">
            <h2>搜索发现</h2>
            <button>麻辣烫</button>
            <button>米线</button>
            <button>披萨</button>
            <button>蛋糕</button>
            <button>汉堡</button>
            <button>腊八粥</button>
            <button>烤肉拌饭</button>
            <button>炸鸡</button>
            <button>密多梅（城阳路店）</button>

        </div>
    </div>
</body>
<script src="./vue-2.5.21.js"></script>
<script>
    var v=new Vue({
        el:'#app',
        data:{
            inputText:'',
            tasklist:[]
        },
        methods:{
            add(){
                if(this.inputText){
                    var obj={id:this.tasklist.length+1,name:this.inputText}
                    this.tasklist.push(obj)
                    this.inputText=''
                }
            },
            del(){
            this.tasklist=[]
        }
        },
        
    })
</script>
</html>